package com.bey.bow.service.course;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.bey.bow.entity.CourseDetail;
import com.bey.bow.repository.CourseDetailDao;

//Spring Bean的标识.
@Component
// 默认将类中的所有public函数纳入事务管理.
@Transactional(readOnly = true)
public class CourseDetailService {

	private CourseDetailDao courseDetailDao;
	
	@Transactional(readOnly = false)
	public void saveCourseDetail(CourseDetail entity) {
		courseDetailDao.save(entity);
	}
	
	

	@Transactional(readOnly = false)
	public void delete(long id) {
		courseDetailDao.delete(id);
	}
	
	public CourseDetail getCourseDetail(Long id) {
		return courseDetailDao.findOne(id);
	}

	@Autowired
	public void setCourseDetailDao(CourseDetailDao courseDetailDao) {
		this.courseDetailDao = courseDetailDao;
	}

}
